<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8"/>
    <meta  charset="utf-8" content="width=device-width, initial-scale=1.0,
    maximum-scale=1.0, user-scalable=0" name="viewport" />

    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>基于pyecharts的2023碳达峰可视化</title>
    <link rel="stylesheet" href="./css/head1.css"/>
<!--    <link rel="stylesheet" href="../css/style.css"/>-->
    <script src="./js/jquery.js"></script>
    <script src="./js/fontscroll.js"></script>
    <script type="text/javascript" src="./js/js.js"></script>
    <script>

        $(document).ready(function () {
            var whei = $(window).width()
            $("html").css({ fontSize: whei / 22 });
            $(window).resize(function () {
                var whei = $(window).width();
                $("html").css({ fontSize: whei / 22 })
            });
        });
    </script>
</head>
<body>
<div class="data">
    <!--  标题  -->
    <div class="loading">
        <div class="loadbox"> <img src="./images/loading.gif">
            <h1 style="color: #ffffff;">loading</h1>
        </div>
  </div>

    <div class="header">
        <div class="header-center fl">
            <div id="title1" class="header-title" style="display: block;">
                全国碳排放情况可视化
            </div>
            <div id="title2" class="header-title" style="display: none;">
                碳排放驱动因素可视化
            </div>
            <div id="title3" class="header-title" style="display: none;">
                碳排放预测可视化
            </div>
            <div class="header-img"></div>
        </div>
    </div>

    <!-- 导航   -->
    <div class="tab">
        <div class="fr nav">
            <ul class="navbar_nav">
                <li>
                    <a class="first" href="javascript:void(0)" style="font-size: 12px;">碳可视化</a>
                </li>
                <li>
                    <a class="second" href="javascript:void(0)" style="font-size: 12px;">因素分析</a>
                </li>
                <li>
                    <a class="three" href="javascript:void(0)" style="font-size: 12px;">预测结论</a>
                </li>
            </ul>
        </div>
    </div>
    <!-- 主页面   -->
    <!-- 页面一    -->
    <div id="page1" class="main" style="display: block;">
        <div id="page1_1" class="main_1" >
            <iframe frameborder="0" src="./html/first.html" width="100%" height="100%" scrolling="no"></iframe>
        </div>

    </div>
    <!-- 页面二   ./second/second/second.html -->
    <div id="page2" class="main" style="display: block;">
        <div id="page2_2" class="main_2" >
            <iframe frameborder="0" src="./second/second/second.html" width="100%" height="100%" scrolling="no" ></iframe>
        </div>
    </div>
    <!-- 页面三   ./final/three.html -->
    <div id="page3" class="main" style="display: block;">
        <div id="page3_3" class="main_3">
            <iframe frameborder="0" src="./final/three.html" width="100%" height="100%" scrolling="no"></iframe>
        </div>
    </div>


</div>


<script>
        window.onload = function(){
            document.getElementById('page2').style.display = 'none'
            document.getElementById('page3').style.display = 'none'
        }
        var lis=document.querySelector('ul').querySelectorAll('li a');
        //获取三个要切换的盒子
        let page1 = document.getElementById('page1')
        let page2 = document.getElementById('page2')
        let page3 = document.getElementById('page3')

        let t1 = document.getElementById('title1')
        let t2 = document.getElementById('title2')
        let t3 = document.getElementById('title3')
        //点击导航栏，改变Iframe的src属性，实现页面切换

        for (let i = 0; i < lis.length; i++) {
            //绑定点击事件
            lis[i].onclick = function(event){
                if(event.target.classList.contains('first')){
                    changPage()
                    page1.style.display = 'block'

                    t1.style.display = 'block'
                    t2.style.display = 'none'
                    t3.style.display = 'none'




                }else if(event.target.classList.contains('second')){
                    changPage()
                    page2.style.display = 'block'
                    t1.style.display = 'none'
                    t2.style.display = 'block'
                    t3.style.display = 'none'



                }else{
                    changPage()
                    page3.style.display = 'block'
                    t1.style.display = 'none'
                    t2.style.display = 'none'
                    t3.style.display = 'block'



                }
            }

        }
        //封装一个排他思想的函数
        function changPage(){
            //获取所有page
            document.querySelectorAll('.main').forEach(el=>{
                el.style.display = 'none'
            })
        }






</script>
</body>
</html>